package cn.com.huak.www.sell.utils;

import lombok.extern.slf4j.Slf4j;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;

/**
 * 唯一性标识符生成器
 * @author huak@wanggang
 * @date 2018/12/31 23:40
 */
@Slf4j
public class KeyUtil {

    public static String genKey(){
        String currentDate = new SimpleDateFormat("yyyyMMddHHmmssS").format(new Date());
        Integer random = new Random().nextInt(900) + 10;
        return currentDate + random;
    }

    public static void main(String[] args) {
        for (int i = 0; i < 1000; i++){
            String s = genKey();
            log.info(s);
        }
    }
}
